package org.jtzc.springaiagent.agent.adaptive;

import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @author wu chuang
 * @description
 */
@Configuration
public class PerformanceTracker {
    Map<String,PerformanceMetrics> map =  new HashMap<>();

    public void recordPerformance(String agentName, String prompt, long duration, Object quality) {
        map.put(agentName, new PerformanceMetrics(prompt, duration, quality));
    }

    public PerformanceMetrics getMetrics(String agentName) {
        PerformanceMetrics performanceMetrics = map.get(agentName);
        return Objects.isNull(performanceMetrics)? new PerformanceMetrics():performanceMetrics;
    }
}
